<html>
<head><meta charset="utf-8"><title>0b and 1b local label references · project-inline-asm · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/index.html">project-inline-asm</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html">0b and 1b local label references</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="207182998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207182998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207182998">(Aug 17 2020 at 18:55)</a>:</h4>
<p>See issue <a href="https://github.com/rust-lang/rust/issues/74558">#74558</a>. It seems that in intel-syntax mode LLVM's integrated assembler will interpret <code>0b</code> and <code>1b</code> as x86 binary literals rather than as local label references.</p>



<a name="207183263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207183263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207183263">(Aug 17 2020 at 18:57)</a>:</h4>
<p>In contrast GAS always interprets these as local labels since it doesn't support the x86 hex/binary literal syntax.</p>



<a name="207183304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207183304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207183304">(Aug 17 2020 at 18:58)</a>:</h4>
<p>It's actually quite easy to fix this for us in LLVM, but then we lose x86 hex/binary literal support.</p>



<a name="207183346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207183346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207183346">(Aug 17 2020 at 18:58)</a>:</h4>
<p>Thoughts?</p>



<a name="207186016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207186016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207186016">(Aug 17 2020 at 19:20)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="239881">@Josh Triplett</span></p>



<a name="207186506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207186506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207186506">(Aug 17 2020 at 19:25)</a>:</h4>
<p>ow ow ow</p>



<a name="207186527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207186527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207186527">(Aug 17 2020 at 19:25)</a>:</h4>
<p>That's not OK; <code>0b</code> <em>does</em> need to be a backwards local label.</p>



<a name="207186595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207186595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207186595">(Aug 17 2020 at 19:26)</a>:</h4>
<p>This is a case where it's really annoying that we <em>can't</em> use prefixes in intel syntax mode.</p>



<a name="207186938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207186938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207186938">(Aug 17 2020 at 19:29)</a>:</h4>
<p>That doesn't help, <code>$label</code> is valid syntax.</p>



<a name="207186966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207186966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207186966">(Aug 17 2020 at 19:29)</a>:</h4>
<p>Hang on a moment...</p>



<a name="207186991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207186991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207186991">(Aug 17 2020 at 19:30)</a>:</h4>
<p>Can you still use the C binary number syntax, <code>0b010101</code>?</p>



<a name="207187079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187079">(Aug 17 2020 at 19:30)</a>:</h4>
<p>Are you talking about a separate Intel x86 binary number syntax with a <code>b</code> <em>suffix</em>, by analogy with the <code>h</code> suffix for hex?</p>



<a name="207187112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187112">(Aug 17 2020 at 19:31)</a>:</h4>
<p>If that's the case, then yeah, that's not as important as local labels.</p>



<a name="207187173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187173">(Aug 17 2020 at 19:31)</a>:</h4>
<p>Yes I'm talking about stuff like <code>04h</code> for hex values.</p>



<a name="207187261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187261">(Aug 17 2020 at 19:32)</a>:</h4>
<p>Is it possible to disable binary literal support without disabling hex literal support?</p>



<a name="207187310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187310">(Aug 17 2020 at 19:32)</a>:</h4>
<p>It'd be nice to have the hex literals because those are more common, and they don't conflict with anything.</p>



<a name="207187324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187324">(Aug 17 2020 at 19:33)</a>:</h4>
<p>In any case we'll have to modify LLVM.</p>



<a name="207187362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187362">(Aug 17 2020 at 19:33)</a>:</h4>
<p>Oh, there isn't a configuration fix here even if we don't mind disabling both?</p>



<a name="207187378"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187378" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187378">(Aug 17 2020 at 19:33)</a>:</h4>
<p>However I would like to point out that hex literals are not supported by GAS. So any code that uses them will fail to compile with a fallback to the system assembler.</p>



<a name="207187445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187445">(Aug 17 2020 at 19:34)</a>:</h4>
<p>Wait, are they not supported even in <code>.intel_syntax noprefix</code> mode?</p>



<a name="207187515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187515">(Aug 17 2020 at 19:34)</a>:</h4>
<p>Nope</p>



<a name="207187528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187528">(Aug 17 2020 at 19:35)</a>:</h4>
<p>Ah. In that case, yeah, let's disable them for portability's sake.</p>



<a name="207187540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187540">(Aug 17 2020 at 19:35)</a>:</h4>
<p>Can we do <em>that</em> without modifying LLVM?</p>



<a name="207187559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187559">(Aug 17 2020 at 19:35)</a>:</h4>
<p>Nope</p>



<a name="207187563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187563">(Aug 17 2020 at 19:35)</a>:</h4>
<p>Sigh.</p>



<a name="207187577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187577">(Aug 17 2020 at 19:35)</a>:</h4>
<p>What's that going to mean for the current system-LLVM support?</p>



<a name="207187652"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187652" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187652">(Aug 17 2020 at 19:36)</a>:</h4>
<p>Can we have some kind of feature-detection mechanism added for this, so that we can tell if we have it and can use it?</p>



<a name="207187660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187660">(Aug 17 2020 at 19:36)</a>:</h4>
<p>(Meaning that rustc can tell if system LLVM has it?)</p>



<a name="207187694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187694">(Aug 17 2020 at 19:36)</a>:</h4>
<p><a href="https://github.com/llvm/llvm-project/blob/master/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp#L156">https://github.com/llvm/llvm-project/blob/master/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp#L156</a></p>



<a name="207187888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207187888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207187888">(Aug 17 2020 at 19:39)</a>:</h4>
<p>Sigh.</p>



<a name="207188683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207188683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207188683">(Aug 17 2020 at 19:46)</a>:</h4>
<p>Unfortunately I don't know how to fix this without breaking Clang or making IR changes. Clang uses <code>intelsyntax</code> for its MS-style <code>__asm</code> but they want hex literals to work.</p>



<a name="207188795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207188795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207188795">(Aug 17 2020 at 19:47)</a>:</h4>
<p><a href="https://reviews.llvm.org/D53535">https://reviews.llvm.org/D53535</a></p>



<a name="207189344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207189344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207189344">(Aug 17 2020 at 19:52)</a>:</h4>
<p>Could you add a third dialect option, for <code>IntelRust</code>? ;)</p>



<a name="207189360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207189360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207189360">(Aug 17 2020 at 19:52)</a>:</h4>
<p>And have our intel syntax use that?</p>



<a name="207189371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207189371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207189371">(Aug 17 2020 at 19:52)</a>:</h4>
<p>Sure, but that's what I meant about IR changes.</p>



<a name="207189403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207189403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207189403">(Aug 17 2020 at 19:53)</a>:</h4>
<p>Ah.</p>



<a name="207189432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207189432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207189432">(Aug 17 2020 at 19:53)</a>:</h4>
<p>It can get messy and breaks cross-lang LTO</p>



<a name="207189451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207189451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207189451">(Aug 17 2020 at 19:53)</a>:</h4>
<p>Sigh. Then in that case, we might as well keep the existing intel syntax, and just add a parameter for "support masm literals" that defaults to true for intel syntax.</p>



<a name="207189530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207189530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207189530">(Aug 17 2020 at 19:54)</a>:</h4>
<p>Again, that parameter needs to pass through the LLVM IR all the way to the back-end</p>



<a name="207189533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207189533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207189533">(Aug 17 2020 at 19:54)</a>:</h4>
<p>It's the same issue.</p>



<a name="207189561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207189561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207189561">(Aug 17 2020 at 19:54)</a>:</h4>
<p>I understand that; I meant, if you <em>have</em> to change the IR anyway, there's no need to make it a new dialect.</p>



<a name="207189772"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207189772" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207189772">(Aug 17 2020 at 19:56)</a>:</h4>
<p>Though I'm tempted to add an <code>intelgnu</code> option that's compatible with the GAS <code>intel_syntax</code>.</p>



<a name="207189806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207189806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207189806">(Aug 17 2020 at 19:57)</a>:</h4>
<p>That way we can improve it in the future, such as by adding support for optional prefixes. :)</p>



<a name="207189844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207189844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207189844">(Aug 17 2020 at 19:57)</a>:</h4>
<p>Intel syntax is such a mess ;_;</p>



<a name="207189864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207189864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207189864">(Aug 17 2020 at 19:57)</a>:</h4>
<p>But in any case, this is <em>definitely</em> a problem. People expect local labels to work, and use them extensively in GCC inline asm.</p>



<a name="207190219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207190219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207190219">(Aug 17 2020 at 20:01)</a>:</h4>
<p>Here's a wild thought...</p>



<a name="207190416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207190416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207190416">(Aug 17 2020 at 20:02)</a>:</h4>
<p>Inline assembly is treated as a string in LLVM IR, right?</p>



<a name="207190440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207190440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207190440">(Aug 17 2020 at 20:02)</a>:</h4>
<p>"here's a string, handle it as inline assembly with these options"?</p>



<a name="207190453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207190453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207190453">(Aug 17 2020 at 20:02)</a>:</h4>
<p>Yes, essentially</p>



<a name="207190461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207190461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207190461">(Aug 17 2020 at 20:03)</a>:</h4>
<p>Then in that case...</p>



<a name="207190556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207190556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207190556">(Aug 17 2020 at 20:03)</a>:</h4>
<p>Since LLVM knows how to fully lex and parse the assembly already, what would happen if we teach LLVM's lexer/parser to do a minor translation here?</p>



<a name="207190631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207190631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207190631">(Aug 17 2020 at 20:04)</a>:</h4>
<p>Emit a string that will work with existing IR.</p>



<a name="207190739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207190739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207190739">(Aug 17 2020 at 20:05)</a>:</h4>
<p>It'd be a pain, but it'd be compatible and wouldn't involve a break-the-world IR change.</p>



<a name="207190781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207190781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207190781">(Aug 17 2020 at 20:05)</a>:</h4>
<p>(That said, doesn't cross-language LTO require exactly the same version of LLVM anyway?)</p>



<a name="207190801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207190801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207190801">(Aug 17 2020 at 20:05)</a>:</h4>
<p>(So is an IR change <em>that</em> bad?)</p>



<a name="207190816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207190816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207190816">(Aug 17 2020 at 20:05)</a>:</h4>
<p>Except inline assembler is only parseable after register substitutions have been performed.</p>



<a name="207190863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207190863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207190863">(Aug 17 2020 at 20:06)</a>:</h4>
<p>Oh. :(</p>



<a name="207190882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207190882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207190882">(Aug 17 2020 at 20:06)</a>:</h4>
<p>Right.</p>



<a name="207190964"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207190964" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207190964">(Aug 17 2020 at 20:06)</a>:</h4>
<p>OK. Then how terrible would it be to make a new assembly dialect here? That would also be the first step towards things like "limit the available macro syntax", if we want to do that.</p>



<a name="207191003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207191003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207191003">(Aug 17 2020 at 20:07)</a>:</h4>
<p>I had that in mind actually</p>



<a name="207191029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207191029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207191029">(Aug 17 2020 at 20:07)</a>:</h4>
<p>If the asm string starts with <code>/* no-masm-literals */</code> then disable masm literals.</p>



<a name="207191057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207191057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207191057">(Aug 17 2020 at 20:07)</a>:</h4>
<p>It's a bit of  a hack though.</p>



<a name="207191224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207191224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207191224">(Aug 17 2020 at 20:09)</a>:</h4>
<p>Oh hey. There are worse plans, yeah.</p>



<a name="207191249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207191249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207191249">(Aug 17 2020 at 20:09)</a>:</h4>
<p>Maybe something non-comment, though, so that if LLVM doesn't understand it it actually breaks?</p>



<a name="207191261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207191261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207191261">(Aug 17 2020 at 20:09)</a>:</h4>
<p><code>.masm_literals off</code>?</p>



<a name="207191272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207191272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207191272">(Aug 17 2020 at 20:09)</a>:</h4>
<p>Actually...</p>



<a name="207191283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207191283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207191283">(Aug 17 2020 at 20:09)</a>:</h4>
<p>Maybe we can fix this on the clang side</p>



<a name="207191333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207191333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207191333">(Aug 17 2020 at 20:10)</a>:</h4>
<p><code>.masm_literals on</code>? ;)</p>



<a name="207191375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207191375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207191375">(Aug 17 2020 at 20:10)</a>:</h4>
<p>Either approach sounds promising, compared to an IR change.</p>



<a name="207191388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207191388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207191388">(Aug 17 2020 at 20:10)</a>:</h4>
<p>Clang runs the asm parser twice: once in the front-end to do variable substitution and infer constraints, once in the backend for codegen (like us).</p>



<a name="207191410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207191410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207191410">(Aug 17 2020 at 20:10)</a>:</h4>
<p>We could have Clang translate MASM literals to standard literals in its front-end pass.</p>



<a name="207191433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207191433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207191433">(Aug 17 2020 at 20:11)</a>:</h4>
<p>And we don't use that front-end pass?</p>



<a name="207191443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207191443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207191443">(Aug 17 2020 at 20:11)</a>:</h4>
<p>And remove MASM literal support from the back-end.</p>



<a name="207191492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207191492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207191492">(Aug 17 2020 at 20:11)</a>:</h4>
<p>That front-end pass is only used for MS-style asm and clang needs to figure out the constraints by parsing the asm.</p>



<a name="207191510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207191510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207191510">(Aug 17 2020 at 20:11)</a>:</h4>
<p>That sounds promising to me, as long as nothing else using LLVM as a backend counts on MASM literal support.</p>



<a name="207191883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207191883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207191883">(Aug 17 2020 at 20:15)</a>:</h4>
<p>Hmm LLVM 11 is getting released in a week...</p>



<a name="207191899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207191899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207191899">(Aug 17 2020 at 20:16)</a>:</h4>
<p>Too late for breaking changes I think :/</p>



<a name="207202307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207202307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207202307">(Aug 17 2020 at 22:05)</a>:</h4>
<p>Guess it'll have to be in LLVM 12, but that's really unfortunate.</p>



<a name="207202413"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207202413" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207202413">(Aug 17 2020 at 22:06)</a>:</h4>
<p>Because it means inline asm probably won't be stable until LLVM 12 is at the earliest, which is probably March of next year.</p>



<a name="207203051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207203051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207203051">(Aug 17 2020 at 22:15)</a>:</h4>
<p>we could filter for invalid syntax and gate on that</p>



<a name="207203128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207203128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207203128">(Aug 17 2020 at 22:16)</a>:</h4>
<p>and we probably should anyway, accidentally stabilizing some assembly features as part of upgrading llvm would be fairly nasty.</p>



<a name="207203138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207203138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207203138">(Aug 17 2020 at 22:16)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> <code>jmp 0b</code> is going to be really common.</p>



<a name="207203192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207203192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207203192">(Aug 17 2020 at 22:16)</a>:</h4>
<p>I know, but you can also let people use rest of the assembly while this is being readied.</p>



<a name="207203200"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207203200" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207203200">(Aug 17 2020 at 22:16)</a>:</h4>
<p>Sure, but I don't think we can call it stable until then.</p>



<a name="207203238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207203238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207203238">(Aug 17 2020 at 22:17)</a>:</h4>
<p>eh, not feature complete maybe.</p>



<a name="207203271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207203271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207203271">(Aug 17 2020 at 22:17)</a>:</h4>
<p>we have many different features that first stabilized or are looking to stabilize a fairly useful subset (const eval, stabilization)</p>



<a name="207204226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207204226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207204226">(Aug 17 2020 at 22:28)</a>:</h4>
<p>Oh I just had an idea: we could make LLVM's asm parser "smart". If a local label has previously been defined then it should parse <code>0b</code> as a local label, otherwise as a literal.</p>



<a name="207204567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207204567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207204567">(Aug 17 2020 at 22:32)</a>:</h4>
<p>...whoa.</p>



<a name="207204576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207204576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207204576">(Aug 17 2020 at 22:32)</a>:</h4>
<p>We're rather lucky in that <code>b</code> is "back", so that <em>would</em> work...</p>



<a name="207204599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207204599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207204599">(Aug 17 2020 at 22:33)</a>:</h4>
<p>Yep</p>



<a name="207204610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207204610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207204610">(Aug 17 2020 at 22:33)</a>:</h4>
<p>If you can make that work, I'm going to be <em>deeply</em> impressed.</p>



<a name="207204613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207204613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207204613">(Aug 17 2020 at 22:33)</a>:</h4>
<p><span aria-label="popcorn" class="emoji emoji-1f37f" role="img" title="popcorn">:popcorn:</span></p>



<a name="207204622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207204622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207204622">(Aug 17 2020 at 22:33)</a>:</h4>
<p>I'm pretty sure I can make it work.</p>



<a name="207204636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207204636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207204636">(Aug 17 2020 at 22:33)</a>:</h4>
<p>Looking at the code right now.</p>



<a name="207204652"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207204652" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207204652">(Aug 17 2020 at 22:33)</a>:</h4>
<p>Does LLVM's parser currently check things like "the local label you referenced actually exists"?</p>



<a name="207204888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207204888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207204888">(Aug 17 2020 at 22:36)</a>:</h4>
<p>Hmm, actually it's a bit trickier since the lexer would need to call back to the parser</p>



<a name="207204936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207204936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207204936">(Aug 17 2020 at 22:36)</a>:</h4>
<p>Could try something more general like "if a local label is defined, disable masm literal parsing"</p>



<a name="207204961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/0b%20and%201b%20local%20label%20references/near/207204961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/0b.20and.201b.20local.20label.20references.html#207204961">(Aug 17 2020 at 22:37)</a>:</h4>
<p>Another option would be to do what Rust does sometimes, and let the lexer do what it's going to do but fix it up in the parser. :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>